package com.gues.ddc_app.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gues.ddc_app.entity.Feedback;
import com.gues.ddc_app.entity.Orders;
import com.gues.ddc_app.entity.ResultData;
import com.gues.ddc_app.service.IFeedbackService;
import com.gues.ddc_app.service.IOrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author huHang
 * @since 2023-02-12
 */
@RestController
@CrossOrigin//跨域
@RequestMapping("/feedback")
public class FeedbackController {
    @Autowired
    private IFeedbackService feedbackService;
    @RequestMapping("/queryAll")
    public ResultData<Feedback> queryAll(Integer page, Integer limit){
        Page<Feedback> menuPage = new Page<>(page,limit);
        feedbackService.page(menuPage);
        int a=(int)menuPage.getTotal();
        ResultData<Feedback> userResultData = new ResultData<>((Integer)a,menuPage.getRecords());
        return userResultData;
    }
    @RequestMapping("/deleteByIds")
    public boolean deleteByIds(Integer[] ids){
        return feedbackService.removeBatchByIds(Arrays.asList(ids));
    }
}
